import { defineStore } from 'pinia'

export const useAppStore = defineStore('app', {
  state: () => ({
    count: 0,
    user: null as any,
    isLoading: false
  }),
  
  getters: {
    doubleCount: (state) => state.count * 2,
    isLoggedIn: (state) => !!state.user
  },
  
  actions: {
    increment() {
      this.count++
    },
    
    setUser(user: any) {
      this.user = user
    },
    
    setLoading(status: boolean) {
      this.isLoading = status
    }
  }
})